package com.twu.biblioteca;

public class LibrarianMenu extends Menu {
    private static final int LIST_BOOKS = 1;
    private static final int QUIT = 2;

    public LibrarianMenu(BookList availableBooks, BookList checkoutBooks, MovieList availableMovies, MovieList checkoutMovies) {
        this.availableBooks = availableBooks;
        this.checkoutBooks = checkoutBooks;
        this.availableMovies = availableMovies;
        this.checkoutMovies = checkoutMovies;
        optionDescriptions = new String[]{"List Books", "Quit"};
    }

    @Override
    public Menu handleOption(int option) {
        if (selectAWrongOption(option)) {
            return this;
        } else {
            if (option == QUIT) {
                Menu menu = new TopMenu(this.availableBooks, this.checkoutBooks, this.availableMovies, this.checkoutMovies);
                return menu;
            }
            listBooks();
            return this;
        }
    }

    private void listBooks() {
        this.availableBooks.printBookListHead();
        System.out.println("##############################  Visible Book List  #################################");
        this.availableBooks.printAllBooksInformation();
        System.out.println("##############################  Checkout Book List  ################################");
        this.checkoutBooks.printCheckoutBooksInformation();
        this.checkoutBooks.printBookListEnd();
    }
}
